namespace Microsoft.AspNetCore.Mvc
{
    /// <summary>
    ///     接口描述
    /// </summary>
    [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Method)]
    public sealed class ApiDescAttribute : ApiExplorerSettingsAttribute
    {
        /// <summary>
        /// </summary>
        public ApiDescAttribute()
        {
            Order = 0;
        }

        /// <summary>
        /// </summary>
        /// <param name="enabled">是否启用</param>
        public ApiDescAttribute(bool enabled)
        {
            IgnoreApi = !enabled;
            Order = 0;
        }

        /// <summary>
        /// </summary>
        /// <param name="groups">分组列表</param>
        public ApiDescAttribute(params string[] groups)
        {
            GroupName = string.Join(",", groups);
            Groups = groups;
            Order = 0;
        }

        /// <summary>
        ///     名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        ///     版本号
        /// </summary>
        public string Version { get; set; }

        /// <summary>
        ///     分组
        /// </summary>
        public string[] Groups { get; set; }

        /// <summary>
        ///     标签
        /// </summary>
        public string Tag { get; set; }

        /// <summary>
        ///     排序
        /// </summary>
        public int Order { get; set; }
    }
}